﻿
CREATE FUNCTION QIC.CallFactory_P(@Token QIC.TokenTable READONLY, @CallerId INT, @CalleeId INT, @ReturnPropertName VARCHAR(50), @TokenMap VARCHAR(50), @Indent INT, @CalleeDelegateName varchar(50))
RETURNS VARCHAR(MAX)
AS
BEGIN

	DECLARE @Call VARCHAR(MAX) 

	SET @Call = ''

	SET @Call += QIC.Indent(@Indent) + 
		'EXEC ' + 
		CASE ISNULL(@ReturnPropertName,'') WHEN '' THEN '' ELSE @ReturnPropertName + ' = ' END  + 
		QIC.ObjectName(@CalleeId) + ' ' + QIC.InterfaceTokenCall(@Token, @CalleeId, @TokenMap)

	RETURN @Call
END

